<!--
 * @Author: wuyue
 * @Date: 2023-02-23 11:43:52
 * @LastEditTime: 2023-03-20 15:32:41
 * @LastEditors: wuyue
 * @Descripttion: 设备使用记录
 * @version: 
-->
<template>
  <div>
    <a-card :bordered="false">
      <title-name :title="title"></title-name>
      <b-table ref="table" bordered :columns="columns" :request="useLogTableData">
      </b-table>
    </a-card>
  </div>
</template>

<script>
import { getuseList } from '@/api/quality/projectMeterageEquipmentAccount'
import moment from 'moment'
export default {
  name: "equipmentUseLog",
  props: {
    title: {
      type: String,
      default() {
        return '设备使用记录'
      }
    },
  },
  data() {
    return {
      columns: [
        {
          title: '序号',
          dataIndex: 'serial',
          width: 70,
          customRender: (text, row , index) => index+1
        },
        {
          title: '领用单位',
          dataIndex: 'receiverCompany'
        },
        {
          title: '领用人',
          dataIndex: 'receiver'
        },
        {
          title: '领用时间',
          dataIndex: 'receiveTime',
          customRender: (text) => {
            return text&&moment(text).locale('zh-cn').format('YYYY-MM-DD')
          }
        },
        {
          title: '领用备注',
          dataIndex: 'remarks'
        },
        {
          title: '收回时间',
          dataIndex: 'takeBackTime',
          customRender: (text) => {
            return text&&moment(text).locale('zh-cn').format('YYYY-MM-DD')
          }
        },
        {
          title: '收回备注',
          dataIndex: 'takeBackRemark'
        },
      ],
      useLogTableData: async (parameter) => {
          let { pageNo, pageSize } = parameter;
          let params = {
            pageNum: pageNo,
            pageSize,
            param: {
              mdOwnId: this.$route.query.mdOwnId,
              projectId: this.$route.query.projectId,
            }
          };
          return getuseList(params).then((res) => {
          if (res.code === '0') {
            return { code: 200, data: res.data?.list, totalSize: res.data?.total }
          }
        })
      },
    }
  }
}
</script>